//
//  RegisterView.m
//  Streaming
//
//  Created by 韩一博 on 15/6/20.
//  Copyright (c) 2015年 liuxun. All rights reserved.
//

#import "RegisterView.h"
#define width 50
#define height 40

@implementation RegisterView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createRegister];
    }
    return self;
}

- (void)createRegister
{
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(width, height, 1.5 * width, height)];
    [self.nameLabel setBackgroundColor:[UIColor whiteColor]];
    self.nameLabel.text = @"用户名称:";
    [self addSubview:self.nameLabel];
    
    self.secretLabel = [[UILabel alloc]initWithFrame:CGRectMake(width, 3 * height, 1.5 * width, height)];
    [self.secretLabel setBackgroundColor:[UIColor whiteColor]];
    self.secretLabel.text = @"您的密码:";
    [self addSubview:self.secretLabel];
    
    self.nameTextField = [[UITextField alloc] initWithFrame:CGRectMake(3 * width, height, 4 * width, height)];
    [self.nameTextField setBackgroundColor:[UIColor whiteColor]];
    self.nameTextField.placeholder = @"请输入您的用户名";
    [self addSubview:self.nameTextField];
    
    self.secretTextField = [[UITextField alloc] initWithFrame:CGRectMake(3 * width, 3 * height, 4 * width, height)];
    [self.secretTextField setBackgroundColor:[UIColor whiteColor]];
    self.secretTextField.placeholder = @"请输入您的密码";
    [self addSubview:self.secretTextField];
    
    self.numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(width, 5 * height, 1.5 * width, height)];
    [self.numberLabel setBackgroundColor:[UIColor whiteColor]];
    self.numberLabel.text = @"验证码:";
    [self addSubview:self.numberLabel];
    
    self.numberTextField = [[UITextField alloc] initWithFrame:CGRectMake(3 * width, 5 * height, 2 * width, height)];
    [self.numberTextField setBackgroundColor:[UIColor whiteColor]];
    self.numberTextField.placeholder = @"四位验证码";
    [self addSubview:self.numberTextField];
    
    self.mustLabel = [[UILabel alloc] initWithFrame:CGRectMake(5 * width, 5 * height, 2 * width, height)];
    [self.mustLabel setBackgroundColor:[UIColor whiteColor]];
    NSInteger x = arc4random() % 9500;
    NSString *str = [NSString stringWithFormat:@"%ld", x];
    self.mustLabel.text = str;
    [self addSubview:self.mustLabel];
    
    self.registerButton = [[UIButton alloc] initWithFrame:CGRectMake(2 * width, 7 * height, 3 * width, height)];
    [self.registerButton setBackgroundColor:[UIColor clearColor]];
    [self.registerButton setTitle:@"注册" forState:UIControlStateNormal];
    [self.registerButton setBackgroundImage:[UIImage imageNamed:@"btn_solid_blue_h90.9.png"] forState:UIControlStateNormal];
//    [self.enterButton addTarget:self action:@selector(enterButtonAction) forControlEvents:UIControlEventTouchUpInside];
//    [self addSubview:self.enterButton];
    
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
